package com.butang.Servce;

import com.butang.Dao.Dao;
import com.butang.project.Emp;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Primary;

import java.util.List;

/**
 * ClassName: Service
 * Package: com.butang.project
 * Description:
 *
 * @Author BuTang
 * @Create 2023/7/3 11:32
 * @Version 1.0
 */

@Primary//优先注入
@org.springframework.stereotype.Service

@Resource(name = "dao")
public class Service {
    @Autowired
    @Resource(name = "dao")
    //@Qualifier("dao")
    private Dao dao ;

    public List<Emp> service() {


        List<Emp> list = dao.listEmp();
        for (Emp emp : list) {
            String gender = emp.getGender();
            if ("1".equals(gender)) emp.setGender("男");
            if ("1".equals(gender)) emp.setGender("女");

            String job = emp.getJob();
            if ("1".equals(job)) {
                emp.setJob("讲师");
            } else if ("2".equals(job)) {
                emp.setJob("班主任");
            } else if ("3".equals(job)) {
                emp.setJob("就业指导");
            }
        }

        return list;

    }
}
